import Vue from 'vue'
import VueRouter from 'vue-router'
import Layout from '@/views/Layout'
Vue.use(VueRouter)
const routes = [
  // 默认地址
  {
    path: '/',
    redirect: '/login'
  },
  // 登录页面
  {
    path: '/login',
    component: () => import('@/views/login')
  },
  // 主页
  {
    path: '/layout',
    component: () => import('@/views/Layout')
  },
  // 工单管理
  {
    path: '/task',
    component: Layout,
    children: [
      {
        path: '',
        name: 'task',
        component: () => import('@/views/task'),
        children: [
          {
            path: 'business',
            name: 'business',
            component: () => import('@/views/task/business')
          },
          {
            path: 'operation',
            name: 'operation',
            component: () => import('@/views/task/operation')
          }
        ]
      }
    ]
  },
  // 首页
  {
    path: '/home',
    component: Layout,
    children: [
      {
        path: '',
        name: 'home',
        component: () => import('@/views/home')
      }
    ]
  },
  // 点位管理
  {
    path: '/node',
    component: Layout,
    children: [
      {
        path: '',
        name: 'node',
        component: () => import('@/views/node'),
        children: [
          {
            path: 'region',
            name: 'region',
            component: () => import('@/views/node/region')
          },
          {
            path: 'nodes',
            name: 'nodes',
            component: () => import('@/views/node/nodes')
          },
          {
            path: 'partner',
            name: 'partner',
            component: () => import('@/views/node/partner')
          }
        ]
      }
    ]
  },
  // 设备管理
  {
    path: '/vm',
    component: Layout,
    children: [
      {
        path: '',
        name: 'vm',
        component: () => import('@/views/vm'),
        children: [
          {
            path: 'indexs',
            name: 'indexs',
            component: () => import('@/views/vm/indexs')
          },
          {
            path: 'status',
            name: 'status',
            component: () => import('@/views/vm/status')
          },
          {
            path: 'type',
            name: 'type',
            component: () => import('@/views/vm/type')
          }
        ]
      }
    ]
  },
  // 人员管理
  {
    path: '/user',
    component: () => import('@/views/user')
  },
  // 商品管理
  {
    path: '/sku',
    component: () => import('@/views/sku')
  },
  // 策略管理
  {
    path: '/policy',
    component: () => import('@/views/policy')
  },
  // 订单管理
  {
    path: '/order',
    component: () => import('@/views/order')
  },
  // 对账统计
  {
    path: '/report',
    component: () => import('@/views/report')
  }
]

const router = new VueRouter({
  routes
})

export default router
